package com.epam.facebook_client.wrapper;

import common.wrapper.JSONObjectWrapper;

import android.os.Parcel;
import android.os.Parcelable;


public class Photos extends JSONObjectWrapper{

	private final static String ID = "id";
	private final static String PICTURE = "picture";
	private final static String SOURCE = "source";
	private final static String TIME = "updated_time";
	private final static String PAGING = "paging";
	private final static String NEXT = "next";

	public Photos() {
		super();
	}

	public Photos(String json) {
		super(json);
	}
	
	public Photos(Parcel source) {
		this(source.readString());
	}

	public String getId() {
		return getString(ID);
	}

	public String getPicture() {
		return getString(PICTURE);
	}

	public String getSource() {
		return getString(SOURCE);
	}

	public String getTime() {
		return getString(TIME);
	}
	
	public String getNext(){
		JSONObjectWrapper jsonObject = getJSONObject(PAGING);
		if (jsonObject != null) {
			return jsonObject.getString(NEXT);
		} else {
			return null;
		}
	}
	
	@Override
	public int describeContents() {
		return 0;
	}

	@Override
	public void writeToParcel(Parcel dest, int flags) {
		dest.writeString(toString());
	}
	
	public static final Parcelable.Creator<Photos> CREATOR = new Creator<Photos>() {

		@Override
		public Photos createFromParcel(Parcel source) {
			return new Photos(source);
		}

		@Override
		public Photos[] newArray(int size) {
			return new Photos[size];
		}
	};
}
